// Mini Hexchess // Copyright 2020, Jay M. Coskey, except functions drawn from Chess.lud, as noted //---------------------------------------- // General functions //---------------------------------------- // Usage: ("Directions" ) (define "Directions" ("P12" (directions #1) (directions #2)) ) (define "IsToEmpty" (is In (to) (sites Empty)) ) (define "IsToEmptyOrEnemy" (or "IsToEmpty" ("IsEnemyAt" (to)) ) ) // Usage: ("P12" ) (define "P12" (if (is Mover P1) #1 #2) ) //---------------------------------------- // King movement //---------------------------------------- // Usage: ("KingCaptureStep" ) (define "KingCaptureStep" (move Step #1 (to if:"IsToEmptyOrEnemy" (apply (if ("IsEnemyAt" (to)) (remove (to) (then (set Counter)) ) ) ) ) #2 ) ) //---------------------------------------- // Pawn movement // Note: Counter is reset in (piece "Pawn" ...). //---------------------------------------- // Pawn promotion //---------------------------------------- // Usage: ("PromoteTo" ) (define "PromoteTo" (move Promote (last To) #1 Mover) ) //------------------------------------------------------------------------------ (game "Mini Hexchess" ("TwoPlayersNorthSouth") (equipment { (board (rotate 90 (hex 4))) (piece "King" Each ("KingCaptureStep" All ~)) (piece "Queen" Each ("SlideCapture" ~ ~ (then (set Counter)))) (piece "Rook" Each ("SlideCapture" Orthogonal ~ (then (set Counter)))) (piece "Bishop" Each ("SlideCapture" Diagonal ~ (then (set Counter)))) ("ChessKnight" "Knight" (then (set Counter))) (piece "Pawn" Each (or { "StepForwardToEmpty" ("StepToEnemy" ("Directions" {NNW NNE} {SSW SSE})) } (then (and (if (is In (last To) (sites Mover "PromotionZone")) (moveAgain) ) (set Counter) ) ) ) ) (regions "PromotionZone" P1 (union (sites Side NW) (sites Side NE))) (regions "PromotionZone" P2 (union (sites Side SW) (sites Side SE))) (regions "Region-Dark" (sites Phase 2)) (regions "Region-Light" (sites Phase 1)) (regions "Region-Medium" (sites Phase 0)) }) (rules (start { (place "King1" coord:"B2") (place "Rook1" coord:"B1") (place "Bishop1" coord:"A1") (place "Knight1" coord:"A2") (place "King2" coord:"F6") (place "Rook2" coord:"F7") (place "Bishop2" coord:"G7") (place "Knight2" coord:"G6") (place "Pawn1" {"A3" "B3" "C3" "C2" "C1"}) (place "Pawn2" {"E7" "E6" "E5" "F5" "G5"}) }) phases:{ (phase "Movement" (play (if ("SameTurn") ("PromoteTo" (piece {"Rook" "Bishop" "Knight"})) (do (forEach Piece) ifAfterwards:(not ("IsInCheck" "King" Mover)) ) ) ) (end { ("Checkmate" "King") (if (or (no Moves Mover) (= (counter) 100) ) (result Mover Draw) ) }) ) } ) ) //------------------------------------------------------------------------------ (metadata (info { (description "A chess variant played on a board made of hexagons invented by Dave McCooey and Richard Honeycutt.") (aliases {"Hexagonal Chess"}) (rules "Mini Hexchess is played on a hexagonal board with each side having length 5, and each space oriented horizontally. The board has 37 spaces. Piece Movement: * Kings, Rooks, Bishops, and Knights move as in Glinski Chess. - Kings step one space in any of the 12 directions. They do not castle. - Rooks slide in any of the 6 adjacent directions. - Bishops slide in any of the 6 'diagonal' directions. - Knights move two spaces in any adjacent direction, then one space in another direction. * There are no Queens in Mini Hexchess. * Pawns can advance one space forward without capturing. Pawns can never advance more than one space. Pawns capture 'diagonally forward' (i.e., to a space ahead connected by an edge, and having the same colour). There is no en passant capture. On reaching the farthest rank in a given file, Pawns are promoted to a Rook, Bishop, or Knight. Note that a Pawn cannot be promoted to a Queen, since there are no Queens in Mini Hexchess. The game ends on a checkmate or stalemate.") (id "854") (source "The setup for Mini Hexchess can be found at the Chess Variant Page (www.chessvariants.com). For a comparison of popular versions of hexagonal chess, see Wikipedia (Wikipedia). For more details on other chess variants, see The Classified Encyclopedia of Chess Variants, by D. B. Pritchard (2nd edition, completed and edited by John Beasley, 2007).") (version "1.3.12") (classification "board/war/replacement/checkmate/chess") (author "Dave McCooey and Richard Honeycutt") (credit "Jay Coskey, with some small functions drawn from Chess.lud, by Eric Piette") (date "1997") } ) (graphics { (piece Scale "Pawn" 0.7) (piece Scale "King" 0.8) (piece Scale "Knight" 0.8) (piece Scale "Bishop" 0.8) (piece Scale "Rook" 0.8) (piece Scale "Pawn" 0.825) (board Style Chess) (region Colour "Region-Dark" (colour "#b5651d")) (region Colour "Region-Light" (colour "#fff8dc")) (region Colour "Region-Medium" (colour "#daae7c")) }) (ai "Mini Hexchess_ai" ) )